package com.infindo.appcreate.zzyj.entity;

import static javax.persistence.GenerationType.SEQUENCE;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.infindo.appcreate.zzyj.util.DateTimeUtil;

@Entity
@Table(name = "zzyj_infomation", schema = "public")
public class Infomation implements java.io.Serializable {

    private static final long serialVersionUID = 6872734083870332220L;
    private Long id;
    private Long code;
    private String title;
    private String image;
    private String origin;
    private Date time;
    private String desc;
    
    private String timeF;//format time item
    
    public Infomation(){}
    
   public Infomation(Long code, String title, String image, String origin, Date time, String desc){
        super();
        this.code = code;
        this.title = title;
        this.image = image;
        this.origin = origin;
        this.time = time;
        this.desc = desc;
   }

	@SequenceGenerator(name = "generator", sequenceName = "seq_zzyj_infomation",allocationSize=1)
	@Id
	@GeneratedValue(strategy = SEQUENCE, generator = "generator")
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	
	@Column(name = "code")
    public Long getCode() {
        return code;
    }
    public void setCode(Long code) {
        this.code = code;
    }
    
    @Column(name = "_desc")
    public String getDesc() {
        return desc;
    }
    public void setDesc(String desc) {
        this.desc = desc;
    }
    
    @Column(name = "image")
    public String getImage() {
        return image;
    }
    public void setImage(String image) {
        this.image = image;
    }

    @Column(name = "title")
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }

    @Column(name = "origin")
    public String getOrigin() {
        return origin;
    }
    public void setOrigin(String origin) {
        this.origin = origin;
    }

    @Column(name = "time")
    public Date getTime() {
        return time;
    }
    public void setTime(Date time) {
        this.time = time;
    }
    
    @Transient
  	public String getTimeF() {
      	if(null != this.time){
      		return DateTimeUtil.DateToString("yyyy.MM.dd", this.time);
      	}
  		return null;
  	}
  	public void setTimeF(String timeF) {
  		this.timeF = timeF;
  	}
	
}
